package com.rock.code.datacollconfig.h3c.domain;

import com.rock.code.common.util.Formater;
import org.apache.log4j.Logger;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * TB_ATO_KPIDETAIL
 *
 * @author wuzeyuan
 * @date 20190307
 */
public class TblATO_KPIDETAIL implements Serializable {

    public String UNIT_ID = null;
    public String KPI_ID = null;
    public String KPI_VALUE = null;
    public Date CLL_TIME = null;
    public String CLL_TIME_STR = null;
    /**
     * 采集周期
     */
    public String INTERVAL = "0";
    public String EXT_INFO = "n/r";
    private Logger logger = Logger.getLogger("COLL");

    @Override
    public String toString() {
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String str = UNIT_ID + "\t" + KPI_ID + "\t" + format.format(CLL_TIME) + "\t"
                + KPI_VALUE + "\t" + INTERVAL + "\t" + EXT_INFO;
        return str;
    }

    public void display() {
        logger.info("-- New KPI:" + this.toString());
    }

    public void setKPI_ID(String cKPI_ID) {
        if (cKPI_ID == null) {
            cKPI_ID = "";
        }
        this.KPI_ID = cKPI_ID;
    }

    public void setUNIT_ID(String cUNIT_ID) {
        if (cUNIT_ID == null) {
            cUNIT_ID = "";
        }
        this.UNIT_ID = cUNIT_ID;
    }

    public void setCLL_TIME(String cCLL_TIME) throws ParseException {
        if (null != cCLL_TIME) {
            this.CLL_TIME = Formater.stringToDateTime(cCLL_TIME);
        } else {
            this.CLL_TIME = new Date();
        }
    }

    public void setCLL_TIME(Date dCLL_TIME) {
        this.CLL_TIME = dCLL_TIME;
    }

    public void setCLL_TIME_STR(Date cll_time) {
        CLL_TIME_STR = Formater.datetimeToString(cll_time);
    }

    public void setKPI_VALUE(String cKPI_VALUE) {
        if (cKPI_VALUE == null) {
            cKPI_VALUE = "";
        }
        this.KPI_VALUE = cKPI_VALUE;
    }

    public void setCLL_TIME_STR(String CLL_TIME_STR) {
        if (CLL_TIME_STR == null) {
            CLL_TIME_STR = "";
        }
        this.CLL_TIME_STR = CLL_TIME_STR;
    }

    public void setINTERVAL(String INTERVAL) {
        if (INTERVAL != null) {
            this.INTERVAL = INTERVAL;
        }
    }

    public void setEXT_INFO(String EXT_INFO) {
        if (EXT_INFO != null) {
            this.EXT_INFO = EXT_INFO;
        }
    }

    public String getUNIT_ID() {
        return UNIT_ID;
    }

    public String getKPI_ID() {
        return KPI_ID;
    }

    public String getKPI_VALUE() {
        return KPI_VALUE;
    }

    public Date getCLL_TIME() {
        return CLL_TIME;
    }

    public String getCLL_TIME_STR() {
        return CLL_TIME_STR;
    }

    public String getINTERVAL() {
        return INTERVAL;
    }

    public String getEXT_INFO() {
        return EXT_INFO;
    }
}
